package com.xxx.mall.feign;

import com.xxx.mall.bo.AuthAccountBO;
import com.xxx.mall.manager.TokenStore;
import com.xxx.mall.response.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author 邢晨旭
 * {@code @date} 2023/11/16
 */
@RestController
@RequestMapping("/feign/token")
public class TokenFeignController implements TokenFeignService {

    @Resource
    TokenStore tokenStore;

    @Override
    @GetMapping("/checkToken")
    public R<AuthAccountBO> checkToken(@RequestParam("accessToken") String accessToken) {
        return R.ok(tokenStore.getUserInfoByAccessToken(accessToken));
    }
}
